package de.encryptor.types;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

import org.hibernate.type.StringType;
import org.jasypt.encryption.pbe.StandardPBEBigDecimalEncryptor;
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
import org.codehaus.groovy.grails.commons.ConfigurationHolder as CH

public class EncryptedDate extends de.encryptor.types.AbstractEncryptedAsStringType {
	private static final long serialVersionUID = 1L;
	
	
	/**
	 * @see de.encryptor.types.AbstractEncryptedAsStringType#convertToObject(java.lang.String)
	 */
	protected Object convertToObject(String string) {
		long timeMillis = Long.valueOf(string).longValue();
		return new Date(timeMillis);
	}
	
	
	/**
	 * @seede.encryptor.types.AbstractEncryptedAsStringType#convertToString(java.lang.Object)
	 */
	protected String convertToString(Object object) {
		long timeMillis = ((Date) object).getTime();
		return String.valueOf(timeMillis);
	}
	
	
	public Class returnedClass() {
		return Date.class;
	}
	
	
	
}
